process.env.NODE_ENV = 'production';
const webpack = require('webpack');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const {entry, plugins, loaders} = require('./webpack.common');
const cfg = require('./config');

module.exports = {
    stats: {
        timings: true,
        children: false
    },
    entry,
    output: {
        publicPath: '/',
        path: cfg.run.web.path,
        filename: '[name].[chunkhash].js',
        chunkFilename: '[name].[chunkhash].js'
    },
    plugins: [
        new CleanWebpackPlugin([`${cfg.run.web.dir}`], {
            root: cfg.root,
            verbose: true
        }),
        new webpack.DefinePlugin({
            'process.env.NODE_ENV': JSON.stringify('production')
        }),
        ...plugins,
        new webpack.optimize.DedupePlugin(),
        new webpack.optimize.UglifyJsPlugin({
            compress: {
                drop_console: true,
                warnings: false
            },
            sourceMap: false,
            comments: false
        })
    ],
    module: loaders
};
